<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <canvas id="c1" height="800" width="800">
        你的浏览器不支持canvas
    </canvas>

    <script>
        // 1. 找到画布对象
        let c1 = document.getElementById('c1')
        let ctx = c1.getContext('2d')//别忘了”二弟“
        ctx.fillRect(0,0,300,300);
        // clearRect方法可以清除矩形，具体来说是根据定位清除画布里的内容。(x,y,width,height)
        ctx.clearRect(0,0,200,200);
    </script>
</body>
</html>